import request from '@/utils/request'

// 精品类别列表page
export function getList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/sq/jpManagement/brandLargeCla/page', data)
}

/**
 * 新增类别
 * @param {*} data
 */
export function save(data) {
  return request.post('/sq/jpManagement/brandLargeCla/save', data)
}

/**
 * 一级类别
 * @param {*} data
 */
export function getOneCat() {
  return request.get('/sq/jpManagement/brandLargeCla/jpApp/upCategory')
}

/**
 * er级类别
 * @param {*} data
 */
export function getTwoCat() {
  return request.get('/sq/jpManagement/brandLargeCla/upCategoryToBySupplier')
}
/**
 * 更新
 * @param {*} data
 */
export function update(data) {
  return request.post('/sq/jpManagement/brandLargeCla/update', data)
}
/**
 * 删除
 * @param {*} id
 */
export function deleteById(id) {
  return request.delete(`/sq/jpManagement/brandLargeCla/${id}`)
}

/**
 * 获取一级类别下的所有的二级类别
 * @param {*} data
 */
export function getAllTwoCat(categoryId) {
  return request.get(`/sq/jpManagement/brandLargeCla/upCategoryTo/${categoryId}`)
}

/**
 * 获取所有精品类别树形
 * @param {*} data
 */
export function getTreeCat(params) {
  return request.post('/sq/jpManagement/brandLargeCla/tree', params)
}

/**
 * 获取供应商的二级类别，没有供应商则为全部二级类别
 * @param {*} supplierId
 */
export function upCategoryToBySupplier(supplierId) {
  return request.get(`/sq/jpManagement/brandLargeCla/upCategoryToBySupplier?supplierId=${supplierId}`,)
}

